﻿<phone:PhoneApplicationPage 
    x:Class="Croxweb.Leuphana.Pages.SchedulePage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="696"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait"  Orientation="Portrait"
    shell:SystemTray.IsVisible="True">

    <!--Transitions-->
    <toolkit:TransitionService.NavigationInTransition>
        <toolkit:NavigationInTransition>
            <toolkit:NavigationInTransition.Backward>
                <toolkit:SlideTransition Mode="SlideUpFadeIn"/>
            </toolkit:NavigationInTransition.Backward>
            <toolkit:NavigationInTransition.Forward>
                <toolkit:TurnstileTransition Mode="ForwardIn"/>
            </toolkit:NavigationInTransition.Forward>
        </toolkit:NavigationInTransition>
    </toolkit:TransitionService.NavigationInTransition>
    <toolkit:TransitionService.NavigationOutTransition>
        <toolkit:NavigationOutTransition>
            <toolkit:NavigationOutTransition.Backward>
                <toolkit:TurnstileTransition Mode="BackwardOut"/>
            </toolkit:NavigationOutTransition.Backward>
            <!--<toolkit:NavigationOutTransition.Forward>
                <toolkit:SlideTransition Mode="SlideUpFadeOut"/>
            </toolkit:NavigationOutTransition.Forward>-->
        </toolkit:NavigationOutTransition>
    </toolkit:TransitionService.NavigationOutTransition>

    <!--LayoutRoot-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
      
        <controls:Pivot Title="STUNDENPLAN">

            <!--Weekly appointments-->
            <controls:PivotItem Header="Woche">
                <ScrollViewer>
                    <StackPanel>
                        <TextBlock Text="Montag" Visibility="{Binding AppointmentsMon, Converter={StaticResource ListVisibilityConverter}}"
                                   Style="{StaticResource PhoneTextLargeStyle}" Margin="{StaticResource PhoneTouchTargetOverhang}" />
                        <ListBox ItemsSource="{Binding AppointmentsMon}" ItemTemplate="{StaticResource AppointmentListTemplate}"
                                 Visibility="{Binding AppointmentsMon, Converter={StaticResource ListVisibilityConverter}}"
                                 ScrollViewer.VerticalScrollBarVisibility="Disabled" SelectionChanged="ListBox_SelectionChanged" />

                        <TextBlock Text="Dienstag" Visibility="{Binding AppointmentsTue, Converter={StaticResource ListVisibilityConverter}}"
                                   Style="{StaticResource PhoneTextLargeStyle}" Margin="{StaticResource PhoneTouchTargetOverhang}" />
                        <ListBox ItemsSource="{Binding AppointmentsTue}" ItemTemplate="{StaticResource AppointmentListTemplate}"
                                 Visibility="{Binding AppointmentsTue, Converter={StaticResource ListVisibilityConverter}}"
                                 ScrollViewer.VerticalScrollBarVisibility="Disabled" SelectionChanged="ListBox_SelectionChanged" />

                        <TextBlock Text="Mittwoch" Visibility="{Binding AppointmentsWed, Converter={StaticResource ListVisibilityConverter}}"
                                   Style="{StaticResource PhoneTextLargeStyle}" Margin="{StaticResource PhoneTouchTargetOverhang}" />
                        <ListBox ItemsSource="{Binding AppointmentsWed}" ItemTemplate="{StaticResource AppointmentListTemplate}"
                                 Visibility="{Binding AppointmentsWed, Converter={StaticResource ListVisibilityConverter}}"
                                 ScrollViewer.VerticalScrollBarVisibility="Disabled" SelectionChanged="ListBox_SelectionChanged" />

                        <TextBlock Text="Donnerstag" Visibility="{Binding AppointmentsThu, Converter={StaticResource ListVisibilityConverter}}"
                                   Style="{StaticResource PhoneTextLargeStyle}" Margin="{StaticResource PhoneTouchTargetOverhang}" />
                        <ListBox ItemsSource="{Binding AppointmentsThu}" ItemTemplate="{StaticResource AppointmentListTemplate}"
                                 Visibility="{Binding AppointmentsThu, Converter={StaticResource ListVisibilityConverter}}"
                                 ScrollViewer.VerticalScrollBarVisibility="Disabled" SelectionChanged="ListBox_SelectionChanged" />

                        <TextBlock Text="Freitag" Visibility="{Binding AppointmentsFri, Converter={StaticResource ListVisibilityConverter}}"
                                   Style="{StaticResource PhoneTextLargeStyle}" Margin="{StaticResource PhoneTouchTargetOverhang}" />
                        <ListBox ItemsSource="{Binding AppointmentsFri}" ItemTemplate="{StaticResource AppointmentListTemplate}"
                                 Visibility="{Binding AppointmentsFri, Converter={StaticResource ListVisibilityConverter}}"
                                 ScrollViewer.VerticalScrollBarVisibility="Disabled" SelectionChanged="ListBox_SelectionChanged" />
                    </StackPanel>
                </ScrollViewer>
            </controls:PivotItem>

            <!--Single appointments-->
            <controls:PivotItem Header="Einzeltermine">
                <ListBox ItemsSource="{Binding AppointmentsSingle}" ItemTemplate="{StaticResource AppointmentSingleListTemplate}"
                         SelectionChanged="ListBox_SelectionChanged" />
            </controls:PivotItem>
        </controls:Pivot>


        <!--Progress Bar-->
        <toolkit:PerformanceProgressBar IsIndeterminate="{Binding IsSynchronizing}" Foreground="{StaticResource PhoneAccentBrush}"
                                        Visibility="{Binding IsSynchronizing, Converter={StaticResource BooleanVisibilityConverter}}"
                                        VerticalAlignment="Top" />
    </Grid>

    <!--ApplicationBar-->
    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem Text="Aktualisieren" Click="Refresh_Click" />
            </shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>

</phone:PhoneApplicationPage>